const url ='http://www.baidu.com/order?user=Tom&id=123&city=南昌'

const output={
    protocol:'http:',
    host:'www.baidu.com',
    path:'/order',
    query:{
        user:'Tom',
        id:'123',
        city:'南昌'
    },
}

function parser(url){
    let res ={}
    const protocolArr=url.split('://')
    const protocol=protocolArr[0]
    const hostname=protocolArr[1].split('/')[0]
    const path=protocolArr[1].split('?')[0].slice(hostname.length)
    const query={}
    const queryArr =protocolArr[1]

    return res
}
console.log(parser(url));
